import arcgis
from arcgis.gis import GIS
from arcgis.raster import *
# from arcgis.layers import Service 
arcgis.__version__
'2.1.0.2'
# Connect to your ArcGIS Enteprise or AGOL
portal_url = 'https://gis.earthdata.nasa.gov/portal'
gis = GIS(portal_url) #anonymous user
map_view = gis.map("Arizona")  # Adjust the location as needed

# Add the raster layer directly to the map
# map_view.add_layer(md_raster)  # Assuming md_raster is your Raster object
map_view
#query Portal Content
query="TEMPO"
max_items=3
portal_content = gis.content.advanced_search(query=query, max_items=max_items)
for item in portal_content['results']:
        display (item)
(Under Development) Tropospheric Emissions: Monitoring of Pollution (TEMPO) Version 03 Level 3 Gridded Formaldehyde (HCHO) Vertical Column (BETA)
The Tropospheric Emissions: Monitoring of Pollution (TEMPO) Formaldehyde Vertical Column Beta layer is a Cloud Raster Format (CRF) image service that provides information on the amount of formaldehyde in the atmosphere, available as approximately one-hour scans for daylight hours over North America, from August 2023 to present. These data should be considered as beta products and are not optimized for operational use.Imagery Layer by ASDC_Publisher
Last Modified: October 24, 2024
0 comments, 75 views
3D Viewer
Apresente uma cena 3D com uma variedade de ferramentas de medição e exploração 3DWeb Mapping Application by esri_pt
Last Modified: February 22, 2024
0 comments, 0 views
Análise CCDC
Avalia alterações nos valores de píxeis ao longo do tempo utilizando o algoritmo de Deteção e Classificação de Alterações Contínuas (CCDC) e gera resultados de modelos.Raster function template by esri_po
Last Modified: November 10, 2021
0 comments, 0 views
item = portal_content['results'][0]
item
(Under Development) Tropospheric Emissions: Monitoring of Pollution (TEMPO) Version 03 Level 3 Gridded Formaldehyde (HCHO) Vertical Column (BETA)
The Tropospheric Emissions: Monitoring of Pollution (TEMPO) Formaldehyde Vertical Column Beta layer is a Cloud Raster Format (CRF) image service that provides information on the amount of formaldehyde in the atmosphere, available as approximately one-hour scans for daylight hours over North America, from August 2023 to present. These data should be considered as beta products and are not optimized for operational use.Imagery Layer by ASDC_Publisher
Last Modified: October 24, 2024
0 comments, 75 views
item_get
tempo=item.id
tempo
'474a1016d4d54f97b99e6926328e01c1'
tempo_layer = gis.content.get(tempo)
tempo_layer
(Under Development) Tropospheric Emissions: Monitoring of Pollution (TEMPO) Version 03 Level 3 Gridded Formaldehyde (HCHO) Vertical Column (BETA)
The Tropospheric Emissions: Monitoring of Pollution (TEMPO) Formaldehyde Vertical Column Beta layer is a Cloud Raster Format (CRF) image service that provides information on the amount of formaldehyde in the atmosphere, available as approximately one-hour scans for daylight hours over North America, from August 2023 to present. These data should be considered as beta products and are not optimized for operational use.Imagery Layer by ASDC_Publisher
Last Modified: October 24, 2024
0 comments, 75 views
# gis = GIS()
map_view = gis.map()
map_view.content.add('474a1016d4d54f97b99e6926328e01c1')
# map_view.add_layer('474a1016d4d54f97b99e6926328e01c1')
map_view.time_slider = True
map_view
AttributeError: 'MapView' object has no attribute 'content'
item_layers = item.layers
for layer in item_layers:
    print(layer)
layer= item_layers[0]
print(layer.url)
layer
md_raster = Raster(layer.url, is_multidimensional=True, engine=None, gis=gis)
md_raster.variable_names
var_name = md_raster.variable_names[0]
var_name
time_variable_values = md_raster.multidimensional_info['multidimensionalInfo']['variables'][0]['dimensions'][0]['values']
len(time_variable_values)
single_time_var = time_variable_values[333]
single_time_var
# Apply the multidimensional filter to subset the raster for the specified time
filtered_raster = multidimensional_filter(
    raster=md_raster,
    variables=[var_name],
    dimension={"StdTime": single_time_var}
)
filtered_raster
map_view
map_view.add_layer(filtered_raster)
from arcgis.mapping import ImageryLayer

# Assuming `filtered_raster` is your subsetted Raster
imagery_layer = ImageryLayer(filtered_raster.url)

# Add the ImageryLayer to the MapView
# map_view = gis.map("Arizona")
map_view.add_layer(imagery_layer)
map_view
from arcgis.mapping import MapView
# Display the filtered raster on a map
map_view = gis.map("Your Location")  # Replace with a relevant location or leave blank
map_view.add_layer(filtered_raster)
map_view
#Print Image Service Multidimensional Info
print(md_raster.multidimensional_info)
item_content = gis.content.get(item.id)
item_content
m = gis.map()
m.add_layer(item_content)
for layer in item.layers:
    print(layer.properties.name)
m = gis.map('Arizona', 3)
m
m.add_layer(gpw_bdc_layer)
pm25_layer = item.layers[0]
pm25_layer
for fn in gpw_bdc_layer.properties.rasterFunctionInfos:
    print(fn['name'])
gpw_bdc_layer.properties.rasterFunctionInfos[0]['name']
from arcgis.raster.functions import apply
try:
    processed_layer = apply(gpw_bdc_layer, "None")  # Use a valid function name here

    # Add the processed layer to the map
    map_view = gis.map('Arizona')
    map_view.add_layer(processed_layer)
    map_view

except Exception as e:
    print("An error occurred:", e)
gis = GIS("home")
map_view = gis.map('Arizona')
map_view.add_layer(gpw_bdc_layer)
map_view
#Assuming `gpw_bdc_layer` is your raster layer item
# Apply a raster function to the layer
processed_layer = apply(gpw_bdc_layer, gpw_bdc_layer.properties.rasterFunctionInfos[0]['name'])

# Create a MapView and add the processed layer directly
map_view = gis.map('Arizona')
map_view.add_layer(processed_layer)
map_view
show(gpw_bdc_layer)
item_content

item_content = gis.content.get(item_id)  # Retrieve the item by ID

# Create a MapView and add the item as a layer
map_view = gis.map()
map_view.add_layer(item_content)
map_view
map = gis.map()
map.add_layer(item)
map